//
//  PdfHomeFileCell.m

#import "PdfHomeFileCell.h"
static NSString * PdfHomeFileCellId = @"PdfHomeFileCellId";
@interface PdfHomeFileCell()
@end
@implementation PdfHomeFileCell
+ (instancetype)pdfHomeFileCell:(UITableView *)tableView{
    PdfHomeFileCell * pdfHomeFileCell = [tableView dequeueReusableCellWithIdentifier:PdfHomeFileCellId];
    if (!pdfHomeFileCell) {
        pdfHomeFileCell = [[PdfHomeFileCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:PdfHomeFileCellId];
    }
    pdfHomeFileCell.backgroundColor = [UIColor clearColor];
    pdfHomeFileCell.selectionStyle = UITableViewCellSelectionStyleNone;
    pdfHomeFileCell.accessoryType = UITableViewCellAccessoryNone;
    return pdfHomeFileCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self makeSubView];
    }
    return self;
}
- (void)makeSubView{
    PdfWeakSelf
    UIView * pdfHomePdfChangeBgView = [[UIView alloc] init];
    pdfHomePdfChangeBgView.backgroundColor = UIColor.clearColor;
    [self.contentView addSubview:pdfHomePdfChangeBgView];
    [pdfHomePdfChangeBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(24)));
        make.right.equalTo(@(-PdfRatio(24)));
        make.top.equalTo(@(PdfRatio(0)));
        make.bottom.equalTo(@(-PdfRatio(24)));
    }];
    UIButton * pdfHomeSigleRelativeBtn = [[UIButton alloc] init];
    [pdfHomeSigleRelativeBtn setBackgroundImage:[UIImage imageNamed:@"pdfHomeRelative"] forState:UIControlStateNormal];
    [pdfHomeSigleRelativeBtn addTarget:self action:@selector(pdfHomeSigleRelative) forControlEvents:UIControlEventTouchUpInside];
    [pdfHomePdfChangeBgView addSubview:pdfHomeSigleRelativeBtn];
    [pdfHomeSigleRelativeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(0)));
        make.right.equalTo(@(PdfRatio(0)));
        make.top.equalTo(@(PdfRatio(0)));
        make.height.equalTo(@(PdfRatio(136)));
    }];
    UIButton * pdfHomeSigleFileBtn = [[UIButton alloc] init];
    [pdfHomeSigleFileBtn setBackgroundImage:[UIImage imageNamed:@"pdfHomeFile"] forState:UIControlStateNormal];
    [pdfHomeSigleFileBtn addTarget:self action:@selector(pdfHomeFile) forControlEvents:UIControlEventTouchUpInside];
    [pdfHomePdfChangeBgView addSubview:pdfHomeSigleFileBtn];
    [pdfHomeSigleFileBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(0)));
        make.top.equalTo(pdfHomeSigleRelativeBtn.mas_bottom).offset(PdfRatio(24));
        make.height.equalTo(@(PdfRatio(136)));
    }];
    UIButton * pdfHomeSigleMyBtn = [[UIButton alloc] init];
    [pdfHomeSigleMyBtn setBackgroundImage:[UIImage imageNamed:@"pdfHomeMy"] forState:UIControlStateNormal];
    [pdfHomeSigleMyBtn addTarget:self action:@selector(pdfHomeMy) forControlEvents:UIControlEventTouchUpInside];
    [pdfHomePdfChangeBgView addSubview:pdfHomeSigleMyBtn];
    [pdfHomeSigleMyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(PdfRatio(0)));
        make.top.equalTo(pdfHomeSigleRelativeBtn.mas_bottom).offset(PdfRatio(24));
        make.height.equalTo(@(PdfRatio(136)));
        make.width.equalTo(pdfHomeSigleFileBtn);
        make.left.equalTo(pdfHomeSigleFileBtn.mas_right).offset(PdfRatio(24));
    }];
}
- (void)pdfHomeSigleRelative{
    if (self.TapHomeRelativeBlock) {
        self.TapHomeRelativeBlock();
    }
}
- (void)pdfHomeFile{
    if (self.TapHomeFileBlock) {
        self.TapHomeFileBlock();
    }
}
- (void)pdfHomeMy{
    if (self.TapHomeMyBlock) {
        self.TapHomeMyBlock();
    }
}
@end
